<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="col-sm-12">
			<div class="ibox">
				<div class="ibox-body">
                    <div class="col-sm-12" style="width: 100%">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>筛选条件</h5>
                            </div>
                            <div class="ibox-content">
                                <div class="layui-form">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width: 100px">查询子菜单</label>
                                        <div class="layui-input-inline">
                                            <select id="menuName" lay-filter="menuName" lay-search="">
                                                <option value="">直接或搜索选择菜单</option>
                                                <option th:each="menu:${menus}" th:value="${menu.id}">[[${menu.name}]]</option>
                                            </select>
                                        </div>

                                        <div class="layui-input-inline" style="float: right; width: auto">
                                            <button type="button"
                                                    class="btn btn-primary btn-sm" title="在根节点下添加菜单" onclick="add('0')">
                                                <i class="fa fa-plus" aria-hidden="true"></i>添加
                                            </button>
                                            <button type="button"
                                                    class="btn btn-primary btn-sm" title="展开所有" onclick="expandAll('0')">
                                                <i class="fa fa-arrows-v" aria-hidden="true"></i>&nbsp;展开所有
                                            </button>
                                            <button type="button"
                                                    class="btn btn-primary btn-sm" title="折叠所有" onclick="expandAll('1')">
                                                <i class="fa  fa-arrows-h" aria-hidden="true"></i>&nbsp;折叠所有
                                            </button>
                                            <a class="btn btn-info btn-sm ' + s_userComment + '" href="#" mce_href="#" title="刷新" onclick="reLoad()"><i class="fa fa-refresh"></i></a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>



					<table id="menuTable" data-mobile-responsive="true">
					</table>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
    <!--常量声明-->
    <script>
        var currentMenu = 0;
    </script>
	<script th:src="@{/static/js/admin/menu/menu_list.js}"></script>
</body>
<script>

    layui.use(['form'], function () {
        var form = layui.form;
        form.on('select(menuName)', function(data){
            if(data.value==currentMenu){
                return;
            } else {
                currentMenu = data.value;
                table.bootstrapTreeTable('refresh',{"menuName":currentMenu});
            }
        });
    });
    function expandAll(type) {
        if(type=='0'){
            table.bootstrapTreeTable('expandAll');
        } else {
            table.bootstrapTreeTable('collapseAll');
        }
    }
</script>
</html>